<template>
  <div class="login">
    <!-- 顶部导航栏 -->
    <van-nav-bar
      style="padding-top: 20px"
      title="登录"
      left-arrow
      @click-left="$router.back()"
    >
      <template #left>
        <van-icon name="arrow-left" color="#333333" size="23" />
      </template>
    </van-nav-bar>
    <!-- 表单 -->
    <van-form @submit="onSubmit">
      <van-field
        v-model="username"
        name="用户名"
        label="用户名"
        :rules="[{ required: true, message: '请填写用户名' }]"
      />
      <van-field
        v-model="password"
        type="password"
        name="密码"
        label="密码"
        :rules="[{ required: true, message: '请填写密码' }]"
      />
      <div style="margin: 16px">
        <van-button class="but" round block native-type="submit">
          登录
        </van-button>
      </div>
    </van-form>
    <!-- p -->
    <p class="bottom" @click="$router.push('/reg')">注册新用户</p>
  </div>
</template>

<script>
export default {
  name: 'LoginView',
  data() {
    return {
      username: '',
      password: ''
    }
  },
  methods: {
    onSubmit(values) {
      console.log('submit', values)
    }
  }
}
</script>

<style lang="less" scoped>
.bottom {
  font-size: 28px;
  text-align: right;
  margin-right: 20px;
  color: #ccc;
}
.van-field {
  font-size: 36px;
  padding: 35px 0;
  text-indent: 1em;
  color: #ccc;
}
.but {
  background: #d81e06;
  height: 105px;
  font-size: 35px;
  color: #fff;
  margin-top: 130px;
}
</style>
